<template>
  <div class="back">

    <el-page-header @back="$router.back()"/>

  </div>
  <EditPopup ref="editRef" @success="onActivated()"/>
  <el-form ref="formRef" class="ls-form" :model="formData" label-width="120px">
    <div class="container">
      <div class="upperPart">
        <!-- 左侧区域 -->
        <div class="left">
          <!-- 上方区域 -->
          <div class="top" id="main">
            <div class="containerleft">
              <div class="title">
                <h2>设备状态</h2>
              </div>
              <div>
                <div v-if="formData.deviceType==1">
                  <el-form-item label="潜污泵" v-if="formData.sewageState == 1" key="sewageState">运行</el-form-item>
                  <el-form-item label="潜污泵" v-else-if="formData.sewageState == 0"> 停止</el-form-item>
                  <el-form-item label="潜污泵" v-else>异常</el-form-item>
                  <el-form-item label="泥浆泵" v-if="formData.mudState == 1" key="mudState">运行</el-form-item>
                  <el-form-item label="泥浆泵" v-else-if="formData.mudState == 0"> 停止</el-form-item>
                  <el-form-item label="泥浆泵" v-else> 异常</el-form-item>
                </div>

                <div v-if="formData.deviceType==2">
                  <el-form-item label="潜污泵1" v-if="formData.sewageState == 1" key="sewageState">运行</el-form-item>
                  <el-form-item label="潜污泵1" v-else-if="formData.sewageState == 0"> 停止</el-form-item>
                  <el-form-item label="潜污泵1" v-else>异常</el-form-item>
                  <el-form-item label="潜污泵2" v-if="formData.mudState == 1" key="mudState">运行</el-form-item>
                  <el-form-item label="潜污泵2" v-else-if="formData.mudState == 0"> 停止</el-form-item>
                  <el-form-item label="潜污泵2" v-else> 异常</el-form-item>
                </div>

                <el-form-item label="实时液位">
                  {{ formData.liqu }}mm
                </el-form-item>
                <el-form-item label="累计总用电数">
                  {{ formData.ebbElectricity + formData.peakElectricity }}度
                </el-form-item>
                <el-form-item label="累计峰用电数">
                  {{ formData.peakElectricity }}度
                </el-form-item>
                <el-form-item label="累计谷用电数">
                  {{ formData.ebbElectricity }}度
                </el-form-item>
              </div>
            </div>
          </div>
        </div>
        <div class="center">
          <div class="title">
            <h2>{{ formData.deviceName }}</h2>
          </div>
          <!-- 上方区域 -->
          <div class="topleft" id="main">

            <el-form-item
                label="设备状态:"
                v-if="formData.deviceState == 1"
                key="deviceState"
            >
              <img src=/src/views/site/images/online.png>
              <p class="online">在线</p>
            </el-form-item>
            <el-form-item label="设备状态:" v-else-if="formData.deviceState == 0">
              <img src=/src/views/site/images/offline.png>
              <p class="offline">离线</p>
            </el-form-item>
            <el-form-item label="设备状态:" v-else="formData.deviceState == 2">
              <img src=/src/views/site/images/offline.png>
              <p class="offline">故障</p>
            </el-form-item>
            <el-form-item label="手/自动状态:" v-if="formData.remoteState == 0" key="remoteState">
              <img src="/src/views/site/images/manual.png">
              <p class="manuaLoperation">手动</p>
            </el-form-item>
            <el-form-item label="手/自动状态:" v-else-if="formData.remoteState == 1">
              <img src="/src/views/site/images/automatic.png">
              <p class="Auto">自动</p>
            </el-form-item>
            <el-form-item label="手/自动状态:" v-else>
              <p class="inching">柜门点动</p>
            </el-form-item>
            <el-form-item label="安装时间:"> {{ formData.createTime }}</el-form-item>
          </div>
          <div class="topright" id="main">
            <el-form-item label="站点负责人:">
              {{ formData.nickName }}{{ formData.mobile }}
            </el-form-item>
            <el-form-item v-if="formData.deviceType === 1" label="潜污泵开启次数:">{{ formData.count === null ? 0 : formData.count }}次 (近一小时内)</el-form-item>
            <el-form-item v-if="formData.deviceType === 2" label="潜污泵1开启次数:">{{ formData.count1 === null ? 0 : formData.count1 }}次 (近一小时内)</el-form-item>
            <el-form-item v-if="formData.deviceType === 2" label="潜污泵2开启次数:">{{ formData.count2 === null ? 0 : formData.count2 }}次 (近一小时内)</el-form-item>
            <el-form-item label="累计运行时间:">{{ formData.runningTime }}小时</el-form-item>
          </div>
        </div>
        <div class="right">
          <!-- 上方区域 -->
          <div class="top" id="main">
            <div class="containerleft">
              <div class="title">
                <h2>远程控制</h2>
              </div>
              <div class="swtext" v-if="formData.deviceType === 1">
                <p>手动/自动</p>
                <p>潜污泵</p>
                <p>泥浆泵</p>
              </div>
              <div class="swtext" v-if="formData.deviceType === 2">
                <p>手动/自动</p>
                <p>潜污泵1</p>
                <p>潜污泵2</p>
              </div>
              <div v-if="kongzhi1" class="swstate" v-loading="loadingsw">
                <div v-if="formData.deviceState==0 || formData.deviceState==2">
                  <el-switch
                      :model-value="true"
                      active-color="red"
                      disabled
                  >
                  </el-switch>
                </div>
                <div v-else-if="formData.deviceState==1">
                  <el-switch
                      v-if="formData.remoteState==2"
                      :model-value="true"
                      active-color="red"
                      disabled
                  >
                  </el-switch>
                  <el-switch
                      v-if="formData.remoteState==1"
                      :model-value="true"
                      active-color="#13ce66"
                      @change="onSwitch1"
                  >
                  </el-switch>
                  <el-switch
                      v-if="formData.remoteState==0"
                      :model-value="false"
                      @change="onSwitch1"
                  >
                  </el-switch>
                </div>
                <div v-else-if="formData.deviceState==2">
                  <el-switch
                      v-if="formData.remoteState==2"
                      :model-value="true"
                      active-color="red"
                      disabled
                  >
                  </el-switch>
                  <el-switch
                      v-if="formData.remoteState==1"
                      :model-value="true"
                      active-color="#13ce66"
                      @change="onSwitch2"
                  >
                  </el-switch>
                  <el-switch
                      v-if="formData.remoteState==0"
                      :model-value="false"
                      @change="onSwitch2"
                  >
                  </el-switch>
                </div>
                <br/>
                <div>
                  <el-switch
                      v-if="formData.sewageState==1&&formData.remoteState!=null"
                      :model-value="true"
                      active-color="#13ce66"
                      @change="onSwitch2"
                  >
                  </el-switch>
                  <el-switch
                      v-if="formData.sewageState==0&&formData.remoteState!=null"
                      :model-value="false"
                      @change="onSwitch2"
                  >
                  </el-switch>
                  <el-switch
                      v-if="formData.sewageState==2||formData.sewageState==null"
                      :model-value="true"
                      active-color="red"
                      @change="onSwitch5"
                  >
                  </el-switch>
                  <el-switch
                      v-if="formData.sewageState==null||formData.remoteState==null"
                      :model-value="true"
                      active-color="#13ce66"
                      disabled
                  >
                  </el-switch>
                </div>
                <br/>
                <div>
                  <el-switch
                      v-if="formData.mudState==1&&formData.remoteState!=null"
                      :model-value="true"
                      active-color="#13ce66"
                      @change="onSwitch3"
                  >
                  </el-switch>
                  <el-switch
                      v-if="formData.mudState==0&&formData.remoteState!=null"
                      :model-value="false"
                      @change="onSwitch3"
                  >
                  </el-switch>
                  <el-switch
                      v-if="formData.mudState==null||formData.mudState==null"
                      :model-value="true"
                      active-color="#13ce66"
                      disabled
                  >
                  </el-switch>
                  <el-switch
                      v-if="formData.mudState==2||formData.remoteState==null"
                      :model-value="true"
                      active-color="red"
                      @change="onSwitch5"
                  >
                  </el-switch>
                </div>

              </div>
              <div v-if="!kongzhi1" class="swstate" v-loading="loadingsw">
                <div>
                  <el-switch
                      :model-value="true"
                      active-color="#999"
                      disabled
                  >
                  </el-switch>
                </div>
                <br/>
                <div>
                  <el-switch
                      :model-value="true"
                      active-color="#999"
                      disabled
                  >
                  </el-switch>
                </div>
                <br/>
                <div>
                  <el-switch
                      :model-value="true"
                      active-color="#999"
                      disabled
                  >
                  </el-switch>
                </div>

              </div>
            </div>
          </div>
        </div>
      </div>
      <!-- 底部区域 -->
      <div class="bottom-container">
        <!-- 底部左侧区域 -->
        <div class="containerleft2">
          <div class="title">
            <h2>参数设置</h2>
            <div class="pwd">
              <el-button
                  v-perms="['device:adjustMoney']"
                  type="primary"
                  :disabled="pwddis.value || formData.deviceState === 0 || formData.remoteState === 2 || formData.deviceState === 2"
                  @click="handleAdd(formData.address)"
              >请先输入密码
              </el-button>
            </div>
          </div>
          <div class="control">
            <p style="color: blue;">一道控制模式</p>
            <div class="control1">
              <P>启 动
                <el-input @change="control" :disabled="inputdis.value" v-model="controlData.strapmm"
                          style="width: 120px;"></el-input>
              </P>
              <P>停 止
                <el-input @change="control" :disabled="inputdis.value" v-model="controlData.stopmm"
                          style="width: 120px;"></el-input>
              </P>
            </div>
            <div class="control2">
              <p><span class="liqutext">液	&nbsp;位&nbsp;	高<br/>于&nbsp;	停&nbsp; 	止														</span>
                <el-input @change="control" :disabled="inputdis.value" v-model="controlData.highStop"
                          style="width: 120px;"></el-input>
              </P>
              <p> 运行停止
                <el-input @change="control" :disabled="inputdis.value" v-model="controlData.runstop"
                          style="width: 120px;"></el-input>
              </P>
            </div>
            <div class="control3">
              <p style="color: blue;">二道控制模式</p>
              <P>
                <el-input @change="control" :disabled="inputdis.value" v-model="controlData.hhsw"
                          style="width: 120px;"></el-input>
                小时启动
              </P>
            </div>
            <div class="control4">
              <p style="color: blue;">泥浆泵启动和停止液位</p>
              <P>
                <el-input @change="control" :disabled="inputdis.value" v-model="controlData.mudStartmm"
                          style="width: 120px;"></el-input>
                启 动
              </P>
              <P>
                <el-input @change="control" :disabled="inputdis.value" v-model="controlData.mudStopmm"
                          style="width: 120px;"></el-input>
                停 止
              </P>
            </div>
            <div class="control5">
              <p style="color: blue;">泥浆泵间隔运行和<br/>运行时间</p>
              <P>
                <el-input @change="control" :disabled="inputdis.value" v-model="controlData.mudMmsw"
                          style="width: 120px;"></el-input>
                分钟关停
              </P>
              <P>
                <el-input @change="control" :disabled="inputdis.value" v-model="controlData.mudHhsw"
                          style="width: 120px;"></el-input>
                小时启动
              </P>
            </div>
          </div>
        </div>
        <!-- 底部右侧区域 -->
        <div class="containeright">
          <div class="title">
            <h2>液位曲线图</h2>
          </div>

          <div class="date">
            实时刷新
            <el-switch style="margin-right: 10px;" :model-value="refresh" @change="onRefresh"/>
            <el-date-picker
                style="width: 180px;"
                v-model="queryParams.date"
                type="date"
                placeholder="选择日期"
                @change="dateChange"
            />
            <el-time-picker
                style="width: 120px;"
                v-model="queryParams.startTime"
                :picker-options="{
					      selectableRange: '00:00:00 - 23:59:00'
					    }"
                @change="dateChange"
            >
            </el-time-picker>
            <el-time-picker
                style="width: 120px;"
                arrow-control
                v-model="queryParams.endTime"
                :picker-options="{
					      selectableRange: '00:00:00 - 23:59:00'
					    }"
                @change="dateChange"
            >
            </el-time-picker>
            <el-button type="primary" @click="exportfile">导出</el-button>
            <!-- <el-switch
            v-if="!refresh"
                :model-value="true"
              @change="onRefresh"
            /> -->
          </div>
          <div id="liqu"></div>
        </div>
        <!-- 				<div class="containeright" v-if="formData.liquData==null">
                    <div class="title">
                        <h2>液位曲线图</h2>
                    </div>
                  <div class="date">
                    该设备暂无液位数据
                  </div>
                </div> -->
      </div>
    </div>
  </el-form>
</template>
<script lang="ts" setup name="deviceEdit">
import * as echarts from 'echarts'
import {ElMessageBox, type FormInstance} from 'element-plus'
import {detail, liqulist, excel, deviceControl, Parameter, Statecontrol} from '@/api/devicebysite'
import feedback from '@/utils/feedback'
import {streamFileDownload} from '@/utils/file'
import EditPopup from '../manage/edit.vue'
import {getDataFormat} from '@/utils/days'
import useUserStore from "@/stores/modules/user";
import {ref} from 'vue'
import {DeviceStateEnum} from "@/enums/deviceEnums";

const showEdit = ref(false)
let loadingsw = ref(false)
let kongzhi1 = ref(true)
let kongzhiPerm = ref(true)
let refresh = ref(true)

const editRef = shallowRef<InstanceType<typeof EditPopup>>()

const inputdis = reactive({
  value: true
});

const pwddis = reactive({
  value: false
});

const switchState = reactive({
  mudState: false,
  sewageState: false,
  remoteState: 1
})

const formRef = shallowRef<FormInstance>()
const route = useRoute()


const queryParams = reactive({
  date: '',
  startTime: '',
  endTime: ''
})

const formData = reactive({
  id: '',
  mudState: '',
  deviceName: '',
  sewageState: '',
  liqu: '',
  peakElectricity: '',
  ebbElectricity: '',
  deviceId: '',
  deviceState: '',
  remoteState: '',
  nickName: '',
  mobile: '',
  createTime: '',
  address: '',
  runningTime: '',
  liquData: null,
  count: 0,
  deviceType: '',
  count1: 0,
  count2: 0,
  updateTime: 0
})


const controlData = reactive({
  hhsw: '',
  highStop: '',
  mudHhsw: '',
  mudMmsw: '',
  mudStartmm: '',
  mudStopmm: '',
  runstop: '',
  stopmm: '',
  strapmm: ''
})


const timer = ref(); // 定时器
let count = ref(0); // 倒计时

const chartData = ref({
  xAxis: [],
  data: []
})

const liqu: never[] = []

const onActivated = async () => {
  const data = await Parameter({
    address: formData.address
  })
  Object.keys(controlData).forEach((key) => {
    //@ts-ignore
    controlData[key] = data[key]
  })
  inputdis.value = false
  pwddis.value = true
}

const control = async () => {
  const data = await deviceControl({
    address: formData.address,
    hhsw: controlData.hhsw,
    highStop: controlData.highStop,
    mudHhsw: controlData.mudHhsw,
    mudMmsw: controlData.mudMmsw,
    mudStartmm: controlData.mudStartmm,
    mudStopmm: controlData.mudStopmm,
    runstop: controlData.runstop,
    stopmm: controlData.stopmm,
    strapmm: controlData.strapmm
  })
  feedback.msgSuccess('参数修改成功')
}

const getDetails = async () => {
  if (refresh.value && route.query.id !== '' && route.query.id !== null && route.query.id !== undefined) {
    const data = await detail({
      id: route.query.id
    })
    Object.keys(formData).forEach((key) => {
      //@ts-ignore
      formData[key] = data[key]
    })
    let date = new Date();
    if (formData.deviceState == DeviceStateEnum.OFF_LINE) {
      date = new Date(formData.updateTime * 1000);
      queryParams.startTime = getDataFormat(formData.updateTime * 1000 - 7200000, 'y-m-d h:i');
      queryParams.endTime = getDataFormat(formData.updateTime * 1000, 'y-m-d h:i');
      refresh.value = false;
    } else {
      queryParams.startTime = getDataFormat((new Date().getTime() - 7200000), 'y-m-d h:i');
      queryParams.endTime = getDataFormat(new Date().getTime(), 'y-m-d h:i');
    }
    queryParams.date = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
    getliqu()
    count.value = 10;
  }
  Verification();
}

//循环请求接口
const Verification = () => {
  timer.value = setInterval(() => {
    if (count.value > 0 && count.value <= 10) {
      // loading.value = false
      count.value--;
    } else if (count.value === 0) {
      getDetails();// 请求数据
      if (!inputdis.value) {
        onActivated();
      }
      clearInterval(timer.value);
      timer.value = null;
    }
  }, 1000);
};

onUnmounted(() => {
  clearInterval(timer.value);
  timer.value = null;
})
//处理时间边界
// const initchartHour = async () => {
//   let endHour = queryParams.endTime.split(' ')[1].split(':')[0]; // 获取结束时间的小时部分
//
//   alert(endHour)
//   if (endHour === '01') {
//     let date = new Date(queryParams.startTime); // 将开始时间转换为日期对象
//     date.setHours(0, 0, 0, 0); // 设置开始时间的小时和分钟为 00:00
//     queryParams.startTime = getDataFormat(date.getTime(), 'y-m-d h:i'); // 更新开始时间
//   }
// }

const exportfile = async () => {
  let start = new Date(queryParams.startTime);
  let end = new Date(queryParams.endTime);
  let date = new Date(queryParams.date);
  queryParams.date = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
  queryParams.startTime = queryParams.date + ' ' + start.getHours() + ':' + start.getMinutes() + ':' + start.getSeconds();
  queryParams.endTime = queryParams.date + ' ' + end.getHours() + ':' + end.getMinutes() + ':' + end.getSeconds();

  const file = await excel({
    deviceAddress: formData.address,
    startTime: queryParams.startTime,
    endTime: queryParams.endTime
  })
  streamFileDownload(file, queryParams.date + '.xls')

}

const onRefresh = async () => {
  console.log("refresh.value" + refresh.value)
  if (formData.deviceState == DeviceStateEnum.OFF_LINE) {
    feedback.msgError('当前设备不在线！')
  } else {
    refresh.value = !refresh.value
  }
}

const onSwitch1 = async (e: any) => {
  if (e) {
    onSwitch(1, formData.mudState, formData.sewageState);
  } else {
    onSwitch(0, formData.mudState, formData.sewageState);
  }

}

const onSwitch2 = async (e: any) => {
  console.log('---switch2---')
  if (formData.deviceState == '0') {
    feedback.msgError('当前设备不在线！')
  } else if (formData.remoteState == '1') {
    feedback.msgError('请先将远程自动关闭再进行操作！')
  } else if (formData.deviceState == '2') {
    feedback.msgError('设备故障,请先排除故障！')
  } else {
    if (e) {
      onSwitch(formData.remoteState, formData.mudState, 1);
    } else {
      onSwitch(formData.remoteState, formData.mudState, 0);
    }
    // 添加关闭潜污泵按钮的逻辑
    formData.sewageState = e ? 1 : 0;
  }
}
const onSwitch3 = async (e: any) => {
  console.log('---switch3---')
  if (formData.deviceState == '0') {
    feedback.msgError('当前设备不在线！')
  } else if (formData.deviceState == '2') {
    feedback.msgError('设备故障,请先排除故障！')
  } else {
    if (formData.remoteState == '1') {
      feedback.msgError('请先将远程自动关闭再进行操作！')
    } else {
      if (e) {
        onSwitch(formData.remoteState, 1, formData.sewageState);
      } else {
        onSwitch(formData.remoteState, 0, formData.sewageState);
      }
      // 添加关闭潜污泵按钮的逻辑
      formData.mudState = e ? 1 : 0;
    }
  }

}
const onSwitch5 = async (e: any) => {
  if (formData.mudState == '2') {
    feedback.msgError('泥浆泵异常,请检查！')
  } else if (formData.sewageState == '2') {
    feedback.msgError('潜污泵异常,请检查！')
  }
}

const onSwitch = async (remoteState, mudState, sewageState) => {
  const confirm = await ElMessageBox.confirm(`确认更改当前配置？`, '提示', {
    confirmButtonText: '确认',
    cancelButtonText: '取消',
    type: 'warning',
  }).catch(() => false);
  if (!confirm) return false;
  if (!kongzhiPerm.value) {
    feedback.msgWarning('操作失败，没有权限')
    return false;
  }
  loadingsw.value = true;
  Statecontrol({
    id: formData.id,
    mudState: mudState,
    sewageState: sewageState,
    remoteState: remoteState
  }).then(result => {
    console.log(result)
    if (result.code == 0) {
      loadingsw.value = false;
      formData.mudState = mudState,
          formData.remoteState = remoteState,
          formData.sewageState = sewageState
      feedback.msgSuccess('发送成功')
    } else {
      loadingsw.value = false;
      feedback.msgWarning('设备正在操作')
    }
  }).catch(error => {
    console.log(error)
    loadingsw.value = false;
    feedback.msgWarning('操作失败，请稍后重试')

  })

}

const handleAdd = async (address: String) => {
  showEdit.value = true
  await nextTick()
  editRef.value?.setFormData({
    address: address
  })
  editRef.value?.open('add')
}


function dateChange(e) {
  let start = new Date(queryParams.startTime);
  let end = new Date(queryParams.endTime);
  let date = new Date(queryParams.date);
  queryParams.date = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
  queryParams.startTime = queryParams.date + ' ' + start.getHours() + ':' + start.getMinutes() + ':' + start.getSeconds();
  queryParams.endTime = queryParams.date + ' ' + end.getHours() + ':' + end.getMinutes() + ':' + end.getSeconds();
  getliqu()
}

const getliqu = async () => {
  const data = await liqulist({
    deviceAddress: formData.address,
    startTime: queryParams.startTime,
    endTime: queryParams.endTime
  })
  chartData.value.xAxis = data.map((i) => i.createTime)
  chartData.value.data = data.map((i) => i.levelNumber)
  const options = {
    xAxis: {
      data: chartData.value.xAxis
    },
    series: [
      {
        data: chartData.value.data
      }
    ]
  }
  const chartDom = document.getElementById('liqu')
  const myChart = echarts.init(chartDom)
  myChart.setOption(options)
}
//控制远程控制按钮
const kongzhi = async () => {
  const value = 'device:controls'
  const userStore = useUserStore()
  const permissions = userStore.perms
  const all_permission = '*'
  const hasPermission = permissions.some((key: string) => {
    return all_permission == key || value.includes(key)
  })

  if (!hasPermission) {
    kongzhiPerm.value = false;
  }
}

getDetails()
kongzhi()

const option = {
  tooltip: {
    trigger: 'axis'
  },
  xAxis: {
    type: 'category'
  },
  yAxis: {
    type: 'value'
  },
  series: [
    {
      name: '液位',
      type: 'line',
      areaStyle: {
        opacity: 0.8,
        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
          {
            offset: 0,
            color: 'RGBA(15, 117, 255, 1)'
          },
          {
            offset: 1,
            color: 'RGBA(15, 117, 255, 0)'
          }
        ])
      },
      smooth: true,
      showSymbol: false
    }
  ]
}
onMounted(() => {
  const chartDom = document.getElementById('liqu')
  echarts.init(chartDom).dispose()
  const myChart = echarts.init(chartDom)
  myChart.setOption(option)
  myChart.resize({
    width: 1000,
    height: 400
  })
})
</script>

<style scoped>
.control1 {

}

.control1 p {
  padding: 5px;
}

.control2 {
  margin-left: 200px;
  margin-top: -105px;
}

.control2 p {
  padding: 5px;
}

.control3 {
  margin-top: 30px;
}

.control4 {
  margin-top: 30px;

}

.control4 p {
  padding: 5px;
}

.control5 {
  margin-left: 200px;
  margin-top: -140px;
}

.control5 p {
  padding: 5px;
}

.date {
  margin-left: 350px;
  margin-top: -50px;
}

#liqu {
  overflow: hidden;
  left: 40px;
}

:deep() .el-form-item {
  display: flex;
  --font-size: 16px;
  margin-bottom: 10px;
}

:deep() .el-form-item__label {
  display: inline-flex;
  justify-content: space-between;
  align-items: flex-start;
  flex: 0 0 auto;
  font-size: var(--el-form-label-font-size);
  color: var(--el-text-color-regular);
  height: 32px;
  line-height: 32px;
  padding: 0 12px;
  box-sizing: border-box;
}

:deep() .el-form-item__content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  flex: 1;
  line-height: 32px;
  position: relative;
  font-size: var(--font-size);
  min-width: 0;
  justify-content: flex-end;
}

.topright :deep() .el-form-item__content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  flex: 1;
  line-height: 32px;
  position: relative;
  font-size: var(--font-size);
  min-width: 0;
  justify-content: normal;
}

.topright :deep() .el-form-item__label {
  display: inline-flex;
  justify-content: space-between;
  align-items: flex-start;
  flex: 0 0 auto;
  font-size: var(--el-form-label-font-size);
  color: var(--el-text-color-regular);
  height: 32px;
  line-height: 32px;
  padding: 0 0px;
  box-sizing: border-box;
}

.topleft :deep() .el-form-item__content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  flex: 1;
  line-height: 32px;
  position: relative;
  font-size: var(--font-size);
  min-width: 0;
  justify-content: normal;
}

.topleft {
  margin: 20px;
}

.center {
  flex-basis: 50%;
  margin-left: 25px;
  height: 35vh;
  background-color: #fff;
}

.container {
  width: 100%;
  height: 85vh;
  display: flex;
  flex-direction: column;
  /* 垂直排列 */
  justify-content: space-between;
  align-items: stretch;
  background-color: #f6f7f8;
}

.upperPart {
  width: 100%;
  flex-basis: 50%;
  /* 占比为50% */
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}

.header {
  margin-top: 30px;
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-weight: bold;
}

.event {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding-top: 10px;
}

.headerOne {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-weight: bold;
}

.eventOne {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding-top: 10px;
}

.left {
  flex-basis: 35%;
  height: 35vh;
  padding: 10px;
  background-color: #fff;
}

.left .containerleft {
  padding-top: 10px;
  background-color: #fff;
  margin-top: -10px;
}

.right {
  flex-basis: 10%;
  height: 35vh;
  padding: 10px;
  margin-left: 25px;
  background-color: #fff;
}

.left .top {
  width: 400px;
  height: 300px;
  left: 50px;
}

.top {
  width: 330px;
  height: 300px;
  left: 50px;
}

.topright {
  height: 300px;
  margin-left: 350px;
  margin-top: -140px;
}

.bottom {
  margin-top: -20px;
  height: 330px;
  margin-bottom: 10px;
  background-color: #fff;
}

.bottom img {
  margin-top: 5px;
  margin-left: 40px;
}

.bottom-row {
  margin-top: -20px;
  display: flex;
  justify-content: space-between;
}

.bottomleft,
.bottomright {
  width: 45%;
  height: 100px;
}

.bottom-container {
  width: 100%;
  flex-basis: 65%;
  /* 占比为50% */
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}

.containerleft2 {
  padding: 10px;
  margin-top: 30px;
  width: 470px;
  background-color: #fff;
  height: 500px
}

.containerleft::-webkit-scrollbar {
  display: none;
}

.containeright {
  margin-right: 40px;
  background-color: #fff;
  margin-top: 25px;
}

.containeright::-webkit-scrollbar {
  display: none;
}

ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
  padding-left: 130px;
  padding-right: 130px;
}

li {
  margin-bottom: 10px;
}

.top-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.site-info {
  position: relative;
  text-align: center;
}

.site-info h2 {
  position: absolute;
  top: 20px;
  left: 65%;
  transform: translateX(-50%);
  font-size: 18px;
}

.site-info p {
  position: absolute;
  top: 55px;
  margin-left: 110px;
  font-size: 30px;
  color: #1679f1;
  font-weight: bold;
}

.site-info h1 {
  position: absolute;
  top: 70px;
  margin-left: 150px;
  color: #1679f1;
}

.topfirst {
  position: relative;
  margin-top: 10px;
  flex-basis: 20%;
  height: 150px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topsecond {
  position: relative;
  margin-top: 10px;
  flex-basis: 20%;
  height: 150px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topthird {
  position: relative;
  margin-top: 10px;
  flex-basis: 20%;
  height: 150px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topfourth {
  position: relative;
  margin-top: 10px;
  flex-basis: 20%;
  height: 150px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.title {
  margin-top: 20px;
  display: flex;
  align-items: center;
}

.title img {
  margin-right: 5px;
}

.title h2 {
  font-size: 20px;
  padding-left: 10px;
  font-weight: bold;
  padding-bottom: 20px;
}

.titleOne {
  margin-top: 10px;
  display: flex;
  align-items: center;
}

.liqutext {

}

.titleOne img {
  margin-right: 5px;
}

.titleOne h2 {
  font-size: 20px;
  font-weight: bold;
}

.titleOne p {
  font-size: 18px;
  font-weight: bold;
  margin-left: 300px;
}

.flow {
  margin-top: 10px;
  margin-left: 10px;
  display: flex;
  align-items: center;
}

.flow h2 {
  font-size: 20px;
  font-weight: bold;
}

.top-one {
  color: red;
}

.top-two {
  color: darkgoldenrod;
}

.top-three {
  color: #d9d967;
}

.incident {
  position: relative;
}

.incident h2 {
  position: absolute;
  top: 10px;
  left: 0;
  margin: 0;
  padding: 10px;
  font-size: 20px;
}

.incident p {
  position: absolute;
  margin-top: 60px;
  margin-left: 20px;
  font-size: 30px;
  font-weight: bold;
  color: #2b85e4;
}

.incident h1 {
  position: absolute;
  margin-top: 70px;
  margin-left: 60px;
  font-size: 18px;
  color: #2b85e4;
}

.textOne {
  position: absolute;
}

.pwd {
  padding-left: 200px;
  padding-bottom: 10px;
}

.swtext {
  text-align: left;
}

.swtext p {
  padding: 20px;
}

.swstate {
  margin-left: 220px;
  margin-top: -180px;
}

.swstate :deep() .el-switch {
  --el-switch-on-color: var(--el-color-primary);
  --el-switch-off-color: var(--el-border-color);
  display: inline-flex;
  align-items: center;
  position: relative;
  font-size: 14px;
  line-height: 20px;
  height: 32px;
  vertical-align: middle;
  padding: 22px;
}

.back {
  width: 469px;
}

.manuaLoperation {
  font-weight: bold;
  color: #2b85e4;
  margin-left: 10px;
}

.Auto {
  font-weight: bold;
  color: #2b85e4;
  margin-left: 10px;
}

.inching {
  font-weight: bold;
  color: #2b85e4;
  margin-left: 10px;
}

.online {
  font-weight: bold;
  color: #2b85e4;
  margin-left: 15px;
  margin-top: 5px;
}

.offline {
  font-weight: bold;
  color: #2b85e4;
  margin-left: 15px;
  margin-top: 5px;
}
</style>

<style lang="less" scoped>
.u-theme-switch {
  :deep(.switch-checked) {
    background: #faad14;

    &:hover:not(.disabled) {
      background: #e8b339;
    }
  }
}

.u-dark-svg {
  width: 12px;
  height: 12px;
  fill: #fff;
}

.u-light-svg {
  width: 12px;
  height: 12px;
  fill: rgba(60, 60, 67, 0.75);
}
</style>
